import { observable, action } from "mobx";
import page from "../../apis/page";

export default class LeftMenuStore {
  @observable formComs = [];

  @action init = () => {
    page.getComponents().then(data => {
      this.formComs = Object.keys(data).map(category => {
        const _map = ({ name, face }) => ({ type: name, name: face });
        const coms = data[category].map(_map);
        
        return { category, coms };
      });
    });
  }
}